scripts=`pwd`/../../scripts
LANG=`cat ../info/lang.var`


if [ $# == 0 ]; then
	echo -n ""
else
	echo "usage make_next.sh"
	exit
fi


prev_itr=`cat now-itr.var`
let next_itr=$prev_itr+1

echo "Iteration" $prev_itr "->" $next_itr

cd ..
dir=i${next_itr}
rm -rf $dir;

#### Iter
mkdir $dir; cd $dir
ln -s ${scripts}/copycat.sh .
ln -s ${scripts}/copycat-train.sh .
ln -s ${scripts}/make-next.sh .
echo $next_itr > now-itr.var


###### corpus
mkdir corpus; cd corpus;
ln -s ../../i${prev_itr}/copycat/src-* .
ln -s ../../i0/corpus/tgt* .
cd ..

##### wa
mkdir wa; cd wa;

if [ ${LANG} == ek ] ; then
	cat ../corpus/src-eval2.tok ../corpus/src-train.tok > src.tok
	cat ../corpus/tgt-eval2.tok ../corpus/tgt-train.tok > tgt.tok
fi

if [ ${LANG} == ck ] ; then
	cat ../corpus/src-eval.tok ../corpus/src-train.tok > src.tok
	cat ../corpus/tgt-eval.tok ../corpus/tgt-train.tok > tgt.tok
fi

if [ ${LANG} == ec ] ; then
	ln -s ../corpus/src-train.tok  src.tok
	ln -s ../corpus/tgt-train.tok  tgt.tok
fi

if [ ${LANG} == ce ] ; then
	ln -s ../corpus/src-train.tok  src.tok
	ln -s ../corpus/tgt-train.tok  tgt.tok
fi

if [ ${LANG} == ef ] ; then
	ln -s ../corpus/src-train.tok  src.tok
	ln -s ../corpus/tgt-train.tok  tgt.tok
fi

ln -s ${scripts}/Makefile.giza-run Makefile
ln -s ${scripts}/eval.sh .
ln -s ${scripts}/symm.sh .
ln -s ${scripts}/recov.sh .
cd ..


# SMT data
mkdir smt; cd smt;
ln -s ${scripts}/Makefile.moses-run Makefile
ln -s ../corpus/*.tok .
cd ..;
cd ..;


### end

cd ..

